package com.calm.singleton

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        say.setOnClickListener {
            for (i in 0..20){
                Thread(
                        Runnable {
                            LazySingleton.getInstance().sayHello("Calm$i")
                            Log.e(this::class.java.simpleName,Thread.currentThread().id.toString())
                        }
                ).start()
            }
            KLazySingleton.INSTANCE.sayHello("Calm")
        }
    }

}
